package com.zkthink.zhl.order.dao;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zkthink.base.R;
import com.zkthink.base.mapper.SuperMapper;
import com.zkthink.clh.order.dto.CouponsPageDTO;
import com.zkthink.clh.order.entity.AppletVip;
import com.zkthink.clh.order.entity.ChlCoupons;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.List;

/**
 * <p>
 * Mapper 接口
 * 车龙惠消费金表
 * </p>
 *
 * @author chenke
 * @date 2022-04-26
 */
@Repository
public interface ChlCouponsMapper extends SuperMapper<ChlCoupons> {
    /**
     * 根据充值金额查询
     * @param recharge
     * @return
     */
    ChlCoupons selectByRecharge(BigDecimal recharge);

    IPage<ChlCoupons> findCoupons(IPage page, @Param("dto") CouponsPageDTO model);
    ChlCoupons findRecharge(BigDecimal recharge);
    @Update("update chl_coupons set is_delete = 1 where id = #{id}")
    int updateDelect(Long id);
    @Select("select * from  chl_coupons where is_delete = 0 order by recharge desc")
    List<ChlCoupons> selectAll();

    @Select("select * from  applet_vip")
    List<AppletVip> selectVip();
}
